const validator = (rules) => {
    console.log(rules,'rules');
  return async (ctx, next) => {
    try {
      ctx.verifyParams(rules);
      await next();
    } catch (err) {
      console.error(err);
      ctx.body = {
        code: 200,
        msg: err.errors,
      };
    }
  };
};

module.exports = validator;
